{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "Using TensorFlow backend.\n"
     ]
    }
   ],
   "source": [
    "import numpy as np\n",
    "from keras.models import Model\n",
    "from keras.layers import Input\n",
    "from keras.layers.pooling import AveragePooling2D\n",
    "from keras import backend as K\n",
    "import json\n",
    "from collections import OrderedDict"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "def format_decimal(arr, places=6):\n",
    "    return [round(x * 10**places) / 10**places for x in arr]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "DATA = OrderedDict()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### AveragePooling2D"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "**[pooling.AveragePooling2D.0] input 6x6x3, pool_size=(2, 2), strides=None, padding='valid', data_format='channels_last'**"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\n",
      "in shape: (6, 6, 3)\n",
      "in: [0.38825, 0.616859, -0.903684, 0.806884, -0.727288, -0.673966, -0.577175, -0.387585, -0.257311, -0.509074, -0.260107, -0.175546, -0.36369, 0.000508, 0.660501, 0.597718, -0.516095, -0.635432, 0.051806, 0.827972, 0.776157, -0.924706, 0.475891, -0.245901, 0.938555, -0.153749, -0.78604, -0.743216, 0.623975, -0.88669, -0.405761, -0.047077, 0.93782, 0.817619, -0.698627, -0.779825, 0.082966, -0.198865, -0.803914, -0.013523, 0.656264, 0.20553, -0.99514, -0.845919, -0.780934, -0.54633, -0.584082, -0.381479, 0.07203, -0.932858, -0.388963, -0.640372, -0.762033, 0.520289, -0.850815, 0.83055, 0.657538, -0.995219, 0.924136, -0.09163, -0.83776, 0.570101, 0.811735, -0.248129, -0.669459, -0.622836, 0.488153, 0.819239, 0.684766, -0.329173, 0.541295, 0.675745, 0.552436, -0.314967, 0.588244, -0.764561, -0.405427, 0.165388, 0.036045, -0.7066, 0.987815, 0.424845, -0.898345, -0.084084, 0.424759, -0.463452, -0.464603, -0.889256, 0.047486, 0.593987, -0.041217, -0.674434, -0.437693, -0.698919, 0.415884, 0.503516, 0.804258, 0.474695, -0.147267, -0.807198, -0.922972, 0.369532, -0.214226, 0.34421, -0.267339, -0.858829, -0.005027, 0.268902]\n",
      "out shape: (3, 3, 3)\n",
      "out: [0.080558, 0.298358, -0.261849, -0.222728, -0.044366, -0.526397, 0.161472, -0.315323, 0.045766, -0.444148, 0.553021, -0.008119, -0.65684, -0.382339, -0.243379, -0.102341, -0.083589, 0.372959, -0.238065, -0.244736, 0.204864, 0.114488, -0.513306, 0.281499, -0.384388, -0.019196, 0.032737]\n"
     ]
    }
   ],
   "source": [
    "data_in_shape = (6, 6, 3)\n",
    "L = AveragePooling2D(pool_size=(2, 2), strides=None, padding='valid', data_format='channels_last')\n",
    "\n",
    "layer_0 = Input(shape=data_in_shape)\n",
    "layer_1 = L(layer_0)\n",
    "model = Model(inputs=layer_0, outputs=layer_1)\n",
    "\n",
    "# set weights to random (use seed for reproducibility)\n",
    "np.random.seed(270)\n",
    "data_in = 2 * np.random.random(data_in_shape) - 1\n",
    "result = model.predict(np.array([data_in]))\n",
    "data_out_shape = result[0].shape\n",
    "data_in_formatted = format_decimal(data_in.ravel().tolist())\n",
    "data_out_formatted = format_decimal(result[0].ravel().tolist())\n",
    "print('')\n",
    "print('in shape:', data_in_shape)\n",
    "print('in:', data_in_formatted)\n",
    "print('out shape:', data_out_shape)\n",
    "print('out:', data_out_formatted)\n",
    "\n",
    "DATA['pooling.AveragePooling2D.0'] = {\n",
    "    'input': {'data': data_in_formatted, 'shape': data_in_shape},\n",
    "    'expected': {'data': data_out_formatted, 'shape': data_out_shape}\n",
    "}"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "**[pooling.AveragePooling2D.1] input 6x6x3, pool_size=(2, 2), strides=(1, 1), padding='valid', data_format='channels_last'**"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\n",
      "in shape: (6, 6, 3)\n",
      "in: [0.277769, -0.324717, -0.828538, 0.27327, -0.103567, 0.352973, -0.424245, 0.084882, -0.667369, -0.013292, -0.730917, 0.020447, -0.56258, -0.930644, -0.372492, 0.595927, 0.519345, 0.659999, -0.520708, -0.060843, 0.140459, 0.198302, 0.525008, 0.508564, 0.513985, 0.548433, 0.271675, -0.565162, -0.896829, 0.987411, 0.60257, 0.39488, 0.475653, 0.972433, 0.770687, -0.124055, 0.063721, -0.033112, 0.644369, -0.013292, 0.534668, -0.326544, 0.600593, -0.767345, -0.525822, -0.635478, 0.78529, 0.647604, 0.495353, -0.380054, -0.630392, 0.527641, -0.343892, 0.405197, -0.065455, -0.574106, -0.493058, 0.61698, -0.069963, 0.061398, 0.283554, 0.200134, 0.271897, 0.354207, -0.121057, -0.577198, -0.193319, -0.167341, 0.497023, 0.674803, 0.365241, -0.254262, -0.267867, 0.90223, -0.960562, 0.833171, -0.360657, 0.290601, 0.737442, -0.656173, -0.311816, -0.544177, 0.681235, 0.530767, 0.674875, -0.511685, -0.21598, -0.544874, -0.748065, 0.353896, 0.636164, -0.775521, 0.5865, -0.297541, -0.861248, 0.22867, -0.888671, -0.295104, -0.709528, -0.899564, -0.16393, 0.021623, 0.23474, 0.825311, 0.721459, -0.493389, -0.979736, 0.698471]\n",
      "out shape: (5, 5, 3)\n",
      "out: [0.057158, 0.00897, 0.043364, 0.140328, 0.263689, 0.116461, -0.122178, -0.248608, 0.153041, -0.134616, -0.540877, 0.277755, 0.402088, 0.188567, 0.159776, -0.067994, 0.24143, 0.241712, 0.324897, 0.210191, -0.018032, -0.021515, -0.082613, 0.345217, -0.025679, -0.024178, 0.370069, 0.649499, 0.110405, 0.031601, 0.150488, -0.035628, -0.028459, 0.371959, -0.025626, -0.129768, 0.150719, 0.024255, -0.04588, 0.005191, 0.02921, -0.015741, 0.37612, -0.131511, 0.004391, 0.279207, -0.025624, -0.275405, 0.617787, -0.221665, 0.07802, 0.207757, 0.026034, -0.021588, 0.072897, -0.029712, 0.058653, 0.152871, -0.265462, 0.095169, 0.225982, -0.273799, 0.036302, 0.0961, -0.543296, -0.125518, -0.398742, -0.108493, -0.117239, -0.133532, 0.207733, 0.264467, -0.032162, -0.353544, 0.389462]\n"
     ]
    }
   ],
   "source": [
    "data_in_shape = (6, 6, 3)\n",
    "L = AveragePooling2D(pool_size=(2, 2), strides=(1, 1), padding='valid', data_format='channels_last')\n",
    "\n",
    "layer_0 = Input(shape=data_in_shape)\n",
    "layer_1 = L(layer_0)\n",
    "model = Model(inputs=layer_0, outputs=layer_1)\n",
    "\n",
    "# set weights to random (use seed for reproducibility)\n",
    "np.random.seed(271)\n",
    "data_in = 2 * np.random.random(data_in_shape) - 1\n",
    "result = model.predict(np.array([data_in]))\n",
    "data_out_shape = result[0].shape\n",
    "data_in_formatted = format_decimal(data_in.ravel().tolist())\n",
    "data_out_formatted = format_decimal(result[0].ravel().tolist())\n",
    "print('')\n",
    "print('in shape:', data_in_shape)\n",
    "print('in:', data_in_formatted)\n",
    "print('out shape:', data_out_shape)\n",
    "print('out:', data_out_formatted)\n",
    "\n",
    "DATA['pooling.AveragePooling2D.1'] = {\n",
    "    'input': {'data': data_in_formatted, 'shape': data_in_shape},\n",
    "    'expected': {'data': data_out_formatted, 'shape': data_out_shape}\n",
    "}"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "**[pooling.AveragePooling2D.2] input 6x7x3, pool_size=(2, 2), strides=(2, 1), padding='valid', data_format='channels_last'**"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\n",
      "in shape: (6, 7, 3)\n",
      "in: [-0.504559, 0.757141, 0.875796, -0.387981, -0.0693, -0.652691, -0.555212, -0.434044, 0.235791, -0.605425, 0.718481, -0.209725, 0.39433, -0.062265, -0.773059, 0.044988, 0.788582, -0.418206, 0.614434, -0.961147, 0.540911, 0.289499, 0.209071, -0.023188, 0.527788, -0.515541, 0.942285, 0.522851, -0.896798, -0.850198, -0.335801, -0.361879, -0.63272, -0.071082, 0.463804, 0.844358, -0.989723, -0.965627, -0.499407, -0.047122, -0.793131, 0.187077, -0.447127, 0.294048, -0.807496, 0.388664, -0.881359, 0.544367, -0.09084, -0.366615, 0.331877, 0.426563, 0.027379, -0.607851, 0.900531, -0.279492, 0.17768, 0.932378, 0.553281, 0.99734, -0.734653, -0.165923, 0.65409, -0.145211, 0.663123, 0.202177, 0.09317, 0.192798, 0.451237, 0.221026, 0.10081, 0.951492, 0.404588, -0.507086, 0.336126, -0.728857, 0.270284, 0.475983, -0.185892, -0.72956, -0.511581, 0.885467, 0.875153, -0.134057, -0.93683, 0.147558, -0.921157, 0.17617, 0.775545, -0.024447, 0.87517, -0.130003, -0.881359, 0.671017, 0.527353, 0.060533, -0.622646, 0.985845, -0.580574, 0.000245, 0.209114, -0.774112, -0.36689, -0.461625, -0.348828, -0.778202, 0.187233, 0.986566, 0.273966, 0.933391, -0.26853, 0.386163, 0.622262, -0.966476, 0.148025, -0.701246, -0.116584, -0.477621, -0.370031, 0.2975, -0.714616, 0.744059, 0.055598, -0.684043, -0.5689, -0.904974]\n",
      "out shape: (3, 6, 3)\n",
      "out: [-0.018813, 0.095343, 0.285551, 0.026861, -0.478921, -0.081203, -0.243397, -0.24356, -0.364213, -0.154494, 0.189535, -0.192787, -0.155372, 0.056124, -0.211579, -0.094356, -0.482831, -0.047406, -0.027626, 0.067153, 0.097571, 0.153005, -0.238591, 0.569743, 0.240334, -0.186378, 0.252911, 0.250706, -0.122229, 0.095485, 0.22954, -0.046372, 0.284856, 0.224325, 0.133238, 0.251448, -0.316224, 0.510932, -0.056892, 0.427868, 0.550299, -0.535203, 0.520094, 0.079592, -0.475971, -0.070307, 0.11048, -0.084781, -0.45366, 0.392247, -0.250397, -0.441326, -0.019338, -0.493079]\n"
     ]
    }
   ],
   "source": [
    "data_in_shape = (6, 7, 3)\n",
    "L = AveragePooling2D(pool_size=(2, 2), strides=(2, 1), padding='valid', data_format='channels_last')\n",
    "\n",
    "layer_0 = Input(shape=data_in_shape)\n",
    "layer_1 = L(layer_0)\n",
    "model = Model(inputs=layer_0, outputs=layer_1)\n",
    "\n",
    "# set weights to random (use seed for reproducibility)\n",
    "np.random.seed(272)\n",
    "data_in = 2 * np.random.random(data_in_shape) - 1\n",
    "result = model.predict(np.array([data_in]))\n",
    "data_out_shape = result[0].shape\n",
    "data_in_formatted = format_decimal(data_in.ravel().tolist())\n",
    "data_out_formatted = format_decimal(result[0].ravel().tolist())\n",
    "print('')\n",
    "print('in shape:', data_in_shape)\n",
    "print('in:', data_in_formatted)\n",
    "print('out shape:', data_out_shape)\n",
    "print('out:', data_out_formatted)\n",
    "\n",
    "DATA['pooling.AveragePooling2D.2'] = {\n",
    "    'input': {'data': data_in_formatted, 'shape': data_in_shape},\n",
    "    'expected': {'data': data_out_formatted, 'shape': data_out_shape}\n",
    "}"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "**[pooling.AveragePooling2D.3] input 6x6x3, pool_size=(3, 3), strides=None, padding='valid', data_format='channels_last'**"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\n",
      "in shape: (6, 6, 3)\n",
      "in: [-0.854543, -0.870111, -0.87286, -0.990279, 0.026656, 0.834258, 0.54258, 0.388678, 0.910394, -0.088349, -0.941987, 0.007755, -0.766095, -0.075795, -0.073943, -0.553323, 0.487258, 0.88023, 0.615826, -0.3918, 0.891342, -0.890455, 0.99043, -0.631608, -0.248472, 0.383838, 0.792751, 0.955487, -0.795833, 0.384227, -0.836322, 0.313652, 0.129072, 0.025198, -0.893169, -0.573061, 0.51981, -0.127744, 0.275786, -0.917598, 0.225447, 0.269189, -0.745953, 0.140139, -0.499236, -0.064302, -0.285927, -0.604032, -0.694563, 0.814249, 0.73014, 0.84118, -0.052894, 0.866443, 0.398754, -0.307916, -0.918251, 0.398447, -0.100506, -0.089271, 0.056899, -0.593616, -0.286881, -0.662206, 0.861996, 0.520411, 0.728449, -0.281539, -0.850054, -0.311174, -0.324808, -0.35726, 0.910107, 0.577164, -0.452505, 0.420273, -0.715862, 0.77891, 0.888231, -0.163103, -0.512929, -0.369687, 0.720922, -0.26729, 0.337569, 0.338127, -0.737, -0.221396, 0.445575, -0.354289, 0.396925, 0.254798, -0.459922, 0.450624, -0.95101, 0.750473, -0.018957, -0.336622, 0.184966, 0.726328, 0.938513, 0.776353, -0.316331, -0.995464, 0.699672, 0.829742, 0.879587, -0.020938]\n",
      "out shape: (2, 2, 3)\n",
      "out: [-0.329898, 0.085059, 0.218891, -0.131232, -0.158938, 0.194092, 0.433478, -0.25963, -0.111712, 0.082366, 0.28699, -0.0656]\n"
     ]
    }
   ],
   "source": [
    "data_in_shape = (6, 6, 3)\n",
    "L = AveragePooling2D(pool_size=(3, 3), strides=None, padding='valid', data_format='channels_last')\n",
    "\n",
    "layer_0 = Input(shape=data_in_shape)\n",
    "layer_1 = L(layer_0)\n",
    "model = Model(inputs=layer_0, outputs=layer_1)\n",
    "\n",
    "# set weights to random (use seed for reproducibility)\n",
    "np.random.seed(273)\n",
    "data_in = 2 * np.random.random(data_in_shape) - 1\n",
    "result = model.predict(np.array([data_in]))\n",
    "data_out_shape = result[0].shape\n",
    "data_in_formatted = format_decimal(data_in.ravel().tolist())\n",
    "data_out_formatted = format_decimal(result[0].ravel().tolist())\n",
    "print('')\n",
    "print('in shape:', data_in_shape)\n",
    "print('in:', data_in_formatted)\n",
    "print('out shape:', data_out_shape)\n",
    "print('out:', data_out_formatted)\n",
    "\n",
    "DATA['pooling.AveragePooling2D.3'] = {\n",
    "    'input': {'data': data_in_formatted, 'shape': data_in_shape},\n",
    "    'expected': {'data': data_out_formatted, 'shape': data_out_shape}\n",
    "}"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "**[pooling.AveragePooling2D.4] input 6x6x3, pool_size=(3, 3), strides=(3, 3), padding='valid', data_format='channels_last'**"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\n",
      "in shape: (6, 6, 3)\n",
      "in: [-0.435009, 0.201501, -0.681363, -0.811313, 0.060126, -0.947933, 0.912581, -0.749398, 0.844538, -0.910303, -0.856781, -0.080695, -0.166022, -0.413048, -0.781875, 0.563974, 0.920102, 0.401339, -0.943181, 0.186116, -0.683515, -0.374605, 0.70951, -0.586563, -0.275291, -0.534364, -0.960036, -0.160182, -0.41779, -0.130589, 0.986081, 0.305141, 0.615662, -0.092727, 0.269622, -0.952567, -0.731103, -0.599094, 0.451914, 0.712397, 0.810706, 0.284282, -0.484034, 0.927006, -0.41316, -0.318487, -0.508042, -0.823328, 0.956542, 0.817234, 0.744611, 0.576766, 0.167498, -0.973517, 0.890611, -0.27329, 0.847902, 0.592758, 0.490906, -0.989938, -0.988842, -0.673523, -0.27775, 0.230788, -0.829108, 0.585532, -0.329767, -0.442711, -0.492356, 0.678033, -0.334675, 0.678995, 0.048404, -0.614302, 0.875987, 0.752386, -0.453498, -0.509042, 0.070098, 0.638125, 0.287031, -0.735811, -0.877859, 0.771431, -0.964955, -0.314677, -0.958671, -0.443623, 0.132964, -0.719679, -0.877667, 0.57693, -0.812055, -0.164988, 0.987855, -0.233015, -0.056945, -0.036791, -0.790691, 0.143959, -0.895631, -0.106962, 0.18543, -0.094571, -0.571984, 0.959223, 0.201375, -0.801232]\n",
      "out shape: (2, 2, 3)\n",
      "out: [-0.269951, 0.112457, -0.299093, 0.159516, 0.031548, -0.220107, 0.029535, 0.071379, -0.177952, -0.030747, -0.383877, -0.179436]\n"
     ]
    }
   ],
   "source": [
    "data_in_shape = (6, 6, 3)\n",
    "L = AveragePooling2D(pool_size=(3, 3), strides=(3, 3), padding='valid', data_format='channels_last')\n",
    "\n",
    "layer_0 = Input(shape=data_in_shape)\n",
    "layer_1 = L(layer_0)\n",
    "model = Model(inputs=layer_0, outputs=layer_1)\n",
    "\n",
    "# set weights to random (use seed for reproducibility)\n",
    "np.random.seed(274)\n",
    "data_in = 2 * np.random.random(data_in_shape) - 1\n",
    "result = model.predict(np.array([data_in]))\n",
    "data_out_shape = result[0].shape\n",
    "data_in_formatted = format_decimal(data_in.ravel().tolist())\n",
    "data_out_formatted = format_decimal(result[0].ravel().tolist())\n",
    "print('')\n",
    "print('in shape:', data_in_shape)\n",
    "print('in:', data_in_formatted)\n",
    "print('out shape:', data_out_shape)\n",
    "print('out:', data_out_formatted)\n",
    "\n",
    "DATA['pooling.AveragePooling2D.4'] = {\n",
    "    'input': {'data': data_in_formatted, 'shape': data_in_shape},\n",
    "    'expected': {'data': data_out_formatted, 'shape': data_out_shape}\n",
    "}"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "**[pooling.AveragePooling2D.5] input 6x6x3, pool_size=(2, 2), strides=None, padding='same', data_format='channels_last'**"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\n",
      "in shape: (6, 6, 3)\n",
      "in: [-0.125356, 0.511947, 0.977383, 0.858394, -0.794002, -0.534285, -0.766965, 0.654446, 0.762435, 0.886059, -0.206896, 0.358434, 0.650236, -0.368147, 0.930344, 0.005596, -0.912441, -0.514276, 0.661159, -0.265948, -0.33534, 0.303754, -0.694753, -0.467584, -0.459445, 0.984093, 0.140222, 0.094479, -0.864972, -0.992886, 0.732824, 0.617015, 0.123734, -0.107109, -0.207075, 0.567955, 0.151587, -0.179476, -0.720315, 0.931922, 0.443601, 0.026364, 0.362116, 0.259068, 0.137704, -0.949458, -0.155576, 0.750443, -0.309371, 0.957827, 0.293626, 0.75601, 0.484291, 0.418412, 0.989403, -0.7105, 0.343155, 0.686513, 0.95702, -0.233024, -0.6605, 0.22654, -0.992112, 0.182307, 0.138459, -0.844054, 0.850009, -0.594768, 0.858828, 0.510735, -0.190459, 0.027627, 0.573869, 0.316089, 0.483877, 0.455003, 0.016416, 0.732321, 0.542675, -0.637051, 0.082804, 0.010443, 0.307308, -0.504457, 0.501281, 0.554288, -0.089267, -0.176817, -0.50771, -0.998761, -0.360166, 0.099193, -0.358136, 0.995764, 0.626967, -0.966323, 0.748799, -0.46523, 0.052632, 0.718055, -0.958678, -0.874386, -0.940887, 0.653789, -0.474716, 0.865378, -0.171639, -0.720755]\n",
      "out shape: (3, 3, 3)\n",
      "out: [0.424488, -0.310689, -0.089957, -0.061468, 0.141668, 0.067051, 0.320387, -0.217662, 0.276939, 0.689856, 0.127661, -0.145955, -0.266384, 0.117123, -0.237005, 0.451846, 0.164223, 0.399623, 0.416118, 0.264666, -0.027065, 0.504993, -0.438413, -0.310852, 0.062239, 0.132182, -0.570875]\n"
     ]
    }
   ],
   "source": [
    "data_in_shape = (6, 6, 3)\n",
    "L = AveragePooling2D(pool_size=(2, 2), strides=None, padding='same', data_format='channels_last')\n",
    "\n",
    "layer_0 = Input(shape=data_in_shape)\n",
    "layer_1 = L(layer_0)\n",
    "model = Model(inputs=layer_0, outputs=layer_1)\n",
    "\n",
    "# set weights to random (use seed for reproducibility)\n",
    "np.random.seed(275)\n",
    "data_in = 2 * np.random.random(data_in_shape) - 1\n",
    "result = model.predict(np.array([data_in]))\n",
    "data_out_shape = result[0].shape\n",
    "data_in_formatted = format_decimal(data_in.ravel().tolist())\n",
    "data_out_formatted = format_decimal(result[0].ravel().tolist())\n",
    "print('')\n",
    "print('in shape:', data_in_shape)\n",
    "print('in:', data_in_formatted)\n",
    "print('out shape:', data_out_shape)\n",
    "print('out:', data_out_formatted)\n",
    "\n",
    "DATA['pooling.AveragePooling2D.5'] = {\n",
    "    'input': {'data': data_in_formatted, 'shape': data_in_shape},\n",
    "    'expected': {'data': data_out_formatted, 'shape': data_out_shape}\n",
    "}"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "**[pooling.AveragePooling2D.6] input 6x6x3, pool_size=(2, 2), strides=(1, 1), padding='same', data_format='channels_last'**"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\n",
      "in shape: (6, 6, 3)\n",
      "in: [0.927558, 0.954497, -0.546525, -0.975187, 0.975493, 0.748701, 0.906737, 0.011258, -0.767498, 0.080722, 0.348565, 0.532929, 0.819838, -0.235737, 0.071352, -0.464627, 0.676233, -0.938063, 0.404647, 0.005288, -0.467162, 0.300994, -0.461576, 0.773871, 0.457991, -0.057002, -0.611412, -0.216971, -0.706481, -0.623068, 0.808304, 0.746127, -0.316212, 0.585527, 0.068347, 0.400019, 0.818245, -0.546795, 0.030489, -0.403841, -0.872729, -0.543241, -0.242974, -0.319083, -0.203291, 0.520698, -0.453413, 0.844481, -0.137935, -0.10827, 0.932857, -0.985742, -0.026215, 0.161408, -0.953268, -0.790171, 0.300361, 0.075468, -0.333595, -0.134203, 0.771658, 0.493261, -0.877091, 0.318693, 0.773952, -0.045066, -0.145568, -0.178218, 0.280139, -0.536252, 0.342281, -0.098287, -0.616093, 0.20835, -0.908296, -0.423003, 0.329704, -0.993454, 0.553917, 0.083639, -0.0942, 0.967139, 0.572631, 0.916684, -0.511894, -0.145753, -0.528621, -0.407482, -0.925896, 0.969241, 0.916127, 0.137389, 0.308877, -0.864746, 0.612963, 0.391537, 0.787458, -0.264652, -0.756817, 0.497126, -0.421888, 0.380658, 0.971988, -0.448492, 0.868565, -0.817334, -0.734519, -0.791084]\n",
      "out shape: (6, 6, 3)\n",
      "out: [0.164503, 0.368426, 0.127221, 0.172634, 0.117043, 0.035916, 0.30712, -0.100915, -0.367262, 0.372973, 0.038119, -0.08375, 0.437261, 0.313743, -0.195726, 0.06045, 0.37229, -0.269022, 0.280011, -0.468953, -0.051511, 0.028042, -0.427598, -0.146018, 0.129686, -0.383995, -0.148322, 0.243524, -0.130509, 0.209514, 0.067539, 0.169997, 0.294518, -0.200107, 0.021066, 0.280713, -0.115849, -0.635823, -0.086648, 0.050078, -0.258037, -0.439457, 0.342019, 0.123679, -0.070242, 0.138972, 0.008513, 0.503103, -0.451374, 0.007395, 0.319029, -0.760997, 0.158033, 0.03156, -0.479224, -0.146428, -0.433898, 0.24451, 0.143252, -0.524737, 0.652852, 0.480871, -0.024918, 0.157092, 0.255653, 0.155784, -0.400299, -0.226896, 0.155618, -0.471867, -0.291807, 0.435477, -0.246929, 0.322102, -0.300334, 0.013407, 0.190413, -0.363234, 0.70141, -0.007568, 0.111581, 0.48109, -0.110875, 0.409321, -0.19118, -0.563665, 0.129525, -0.612408, -0.830207, 0.089078, 0.02569, 0.375176, 0.350207, -0.038644, 0.174156, -0.18264, 0.642292, -0.34327, -0.18808, 0.734557, -0.43519, 0.624611, 0.077327, -0.591505, 0.03874, -0.817334, -0.734519, -0.791084]\n"
     ]
    }
   ],
   "source": [
    "data_in_shape = (6, 6, 3)\n",
    "L = AveragePooling2D(pool_size=(2, 2), strides=(1, 1), padding='same', data_format='channels_last')\n",
    "\n",
    "layer_0 = Input(shape=data_in_shape)\n",
    "layer_1 = L(layer_0)\n",
    "model = Model(inputs=layer_0, outputs=layer_1)\n",
    "\n",
    "# set weights to random (use seed for reproducibility)\n",
    "np.random.seed(276)\n",
    "data_in = 2 * np.random.random(data_in_shape) - 1\n",
    "result = model.predict(np.array([data_in]))\n",
    "data_out_shape = result[0].shape\n",
    "data_in_formatted = format_decimal(data_in.ravel().tolist())\n",
    "data_out_formatted = format_decimal(result[0].ravel().tolist())\n",
    "print('')\n",
    "print('in shape:', data_in_shape)\n",
    "print('in:', data_in_formatted)\n",
    "print('out shape:', data_out_shape)\n",
    "print('out:', data_out_formatted)\n",
    "\n",
    "DATA['pooling.AveragePooling2D.6'] = {\n",
    "    'input': {'data': data_in_formatted, 'shape': data_in_shape},\n",
    "    'expected': {'data': data_out_formatted, 'shape': data_out_shape}\n",
    "}"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "**[pooling.AveragePooling2D.7] input 6x7x3, pool_size=(2, 2), strides=(2, 1), padding='same', data_format='channels_last'**"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\n",
      "in shape: (6, 7, 3)\n",
      "in: [-0.030989, -0.346015, -0.890642, 0.30811, -0.606825, 0.402975, 0.602736, 0.344604, 0.306091, -0.032882, -0.087472, -0.504624, -0.540123, -0.600461, -0.356026, -0.166262, -0.931461, -0.400375, 0.139861, -0.018562, -0.77588, 0.053876, 0.409865, 0.873443, 0.68555, 0.27871, 0.850652, 0.754905, -0.449262, 0.988666, 0.820557, 0.32874, -0.511855, -0.376221, 0.156768, 0.714855, 0.652744, -0.770455, -0.420355, -0.112187, 0.057803, 0.08658, -0.290285, 0.132163, 0.355278, 0.478874, 0.219867, 0.84058, -0.208074, -0.408705, -0.531282, 0.413349, 0.231145, -0.454075, -0.873335, 0.392051, 0.153578, -0.986842, 0.015453, 0.397118, 0.508155, 0.965975, 0.697653, -0.112096, 0.759372, 0.559116, 0.67722, -0.117106, -0.590918, -0.665737, 0.55871, -0.858197, -0.708748, 0.748662, -0.824209, 0.616397, -0.011734, -0.182872, -0.733068, 0.364029, 0.561509, 0.219712, 0.973953, -0.171855, 0.60424, -0.828373, -0.98636, 0.448686, -0.322057, 0.982714, -0.821071, 0.580936, -0.725164, -0.374259, 0.933695, 0.162221, 0.253756, -0.83158, 0.440214, 0.612281, -0.342427, -0.890935, 0.767288, -0.113737, 0.239906, -0.787757, 0.979323, 0.603794, 0.819906, -0.759745, 0.3452, -0.275531, -0.838519, -0.306254, 0.019171, 0.086698, 0.646429, -0.657404, 0.564509, -0.150949, 0.885221, -0.240635, 0.774093, 0.413537, 0.353869, -0.54616]\n",
      "out shape: (3, 7, 3)\n",
      "out: [0.254137, -0.066066, 0.309107, 0.587825, -0.108193, 0.637096, 0.536329, 0.034152, 0.069569, -0.032167, -0.050606, -0.164412, -0.107466, -0.536402, -0.115475, 0.128539, -0.415669, -0.377508, 0.013837, 0.019621, -0.34465, 0.188428, 0.248574, 0.291014, 0.070571, 0.063191, -0.284954, -0.292303, 0.282453, -0.666941, -0.138084, 0.340031, -0.326895, -0.494212, 0.18995, 0.232333, -0.248011, 0.579852, 0.371106, 0.363933, 0.969964, 0.262899, 0.271269, -0.232713, 0.236337, 0.042998, -0.334846, 0.074124, -0.362923, 0.190702, -0.055692, -0.189684, 0.188331, 0.274478, 0.273463, -0.212533, 0.043106, 0.669582, -0.085733, -0.105774, 0.590413, 0.120066, -0.153127]\n"
     ]
    }
   ],
   "source": [
    "data_in_shape = (6, 7, 3)\n",
    "L = AveragePooling2D(pool_size=(2, 2), strides=(2, 1), padding='same', data_format='channels_last')\n",
    "\n",
    "layer_0 = Input(shape=data_in_shape)\n",
    "layer_1 = L(layer_0)\n",
    "model = Model(inputs=layer_0, outputs=layer_1)\n",
    "\n",
    "# set weights to random (use seed for reproducibility)\n",
    "np.random.seed(277)\n",
    "data_in = 2 * np.random.random(data_in_shape) - 1\n",
    "result = model.predict(np.array([data_in]))\n",
    "data_out_shape = result[0].shape\n",
    "data_in_formatted = format_decimal(data_in.ravel().tolist())\n",
    "data_out_formatted = format_decimal(result[0].ravel().tolist())\n",
    "print('')\n",
    "print('in shape:', data_in_shape)\n",
    "print('in:', data_in_formatted)\n",
    "print('out shape:', data_out_shape)\n",
    "print('out:', data_out_formatted)\n",
    "\n",
    "DATA['pooling.AveragePooling2D.7'] = {\n",
    "    'input': {'data': data_in_formatted, 'shape': data_in_shape},\n",
    "    'expected': {'data': data_out_formatted, 'shape': data_out_shape}\n",
    "}"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "**[pooling.AveragePooling2D.8] input 6x6x3, pool_size=(3, 3), strides=None, padding='same', data_format='channels_last'**"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\n",
      "in shape: (6, 6, 3)\n",
      "in: [-0.608354, 0.814456, 0.038567, 0.476287, 0.216015, -0.481648, 0.644763, 0.10917, -0.471387, -0.32636, -0.733307, 0.809109, 0.938018, 0.45454, 0.380736, -0.549826, 0.581014, -0.136962, 0.510985, -0.437531, 0.591492, 0.78169, 0.91889, -0.091291, 0.92621, 0.499937, 0.783184, 0.856769, 0.825821, -0.337421, -0.464183, 0.355169, -0.27325, -0.710723, 0.88219, 0.170054, 0.491526, -0.54194, 0.599706, -0.258815, 0.851444, 0.993577, -0.257873, 0.639983, 0.717092, -0.756212, 0.835492, 0.687835, 0.419306, 0.437005, 0.499287, 0.611132, -0.343117, 0.655711, 0.887305, 0.274611, 0.808091, -0.526638, -0.656007, -0.224877, -0.516879, 0.925214, 0.465157, -0.583775, -0.778813, -0.742375, 0.581248, 0.683255, 0.656146, 0.421657, 0.606407, 0.192823, -0.079634, 0.840454, 0.283657, 0.437733, 0.422174, 0.136574, -0.183453, 0.489156, -0.046592, -0.593012, 0.673468, -0.850704, 0.291874, 0.50983, 0.195928, -0.861694, -0.667353, -0.917666, -0.893135, -0.40417, 0.596787, -0.693049, -0.689967, 0.716219, -0.853606, 0.080078, 0.645037, -0.438396, 0.947757, -0.117767, 0.273004, 0.764594, 0.361936, 0.067879, 0.692411, 0.484743]\n",
      "out shape: (2, 2, 3)\n",
      "out: [0.300713, 0.341158, 0.297699, 0.001991, 0.36609, 0.272789, -0.26904, 0.142394, 0.375561, -0.093468, 0.381284, -0.081882]\n"
     ]
    }
   ],
   "source": [
    "data_in_shape = (6, 6, 3)\n",
    "L = AveragePooling2D(pool_size=(3, 3), strides=None, padding='same', data_format='channels_last')\n",
    "\n",
    "layer_0 = Input(shape=data_in_shape)\n",
    "layer_1 = L(layer_0)\n",
    "model = Model(inputs=layer_0, outputs=layer_1)\n",
    "\n",
    "# set weights to random (use seed for reproducibility)\n",
    "np.random.seed(278)\n",
    "data_in = 2 * np.random.random(data_in_shape) - 1\n",
    "result = model.predict(np.array([data_in]))\n",
    "data_out_shape = result[0].shape\n",
    "data_in_formatted = format_decimal(data_in.ravel().tolist())\n",
    "data_out_formatted = format_decimal(result[0].ravel().tolist())\n",
    "print('')\n",
    "print('in shape:', data_in_shape)\n",
    "print('in:', data_in_formatted)\n",
    "print('out shape:', data_out_shape)\n",
    "print('out:', data_out_formatted)\n",
    "\n",
    "DATA['pooling.AveragePooling2D.8'] = {\n",
    "    'input': {'data': data_in_formatted, 'shape': data_in_shape},\n",
    "    'expected': {'data': data_out_formatted, 'shape': data_out_shape}\n",
    "}"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "**[pooling.AveragePooling2D.9] input 6x6x3, pool_size=(3, 3), strides=(3, 3), padding='same', data_format='channels_last'**"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\n",
      "in shape: (6, 6, 3)\n",
      "in: [0.171575, -0.01371, 0.669445, 0.471563, -0.43304, -0.948817, 0.891046, 0.345734, -0.618425, 0.178066, 0.566425, 0.651806, -0.679432, -0.340808, -0.856184, 0.880661, 0.739249, -0.736727, -0.000875, 0.565201, -0.716035, -0.230306, -0.308616, 0.844726, 0.8199, 0.814069, 0.78588, -0.097822, 0.987499, -0.831452, -0.075891, 0.222998, 0.855855, 0.184853, 0.216484, 0.67179, 0.320002, 0.777718, -0.328422, 0.352854, -0.70515, 0.602826, -0.341731, 0.944352, 0.144706, 0.738155, -0.458994, -0.500593, -0.052743, -0.397156, 0.086182, -0.389886, -0.179817, -0.573505, -0.704485, 0.215619, 0.580762, 0.445583, -0.941526, -0.391809, 0.79715, -0.173917, 0.115565, -0.647815, -0.498079, 0.846334, 0.37206, -0.970387, 0.431344, 0.430746, 0.647521, -0.134103, 0.236121, 0.228449, 0.961617, 0.615245, -0.43955, 0.231622, -0.449544, -0.076076, 0.938768, -0.004633, 0.245633, 0.15158, -0.74244, 0.156049, 0.392354, -0.577064, 0.550525, -0.447511, 0.327057, 0.412246, 0.143231, -0.796634, -0.261061, 0.231928, 0.353476, 0.647848, -0.841934, 0.204776, -0.539921, -0.791494, -0.838732, 0.137563, -0.107536, 0.002298, 0.613496, 0.142227]\n",
      "out shape: (2, 2, 3)\n",
      "out: [0.27267, 0.220729, 0.048432, 0.076218, 0.150654, -0.136981, 0.091552, -0.043108, 0.218861, -0.200089, 0.038044, 0.053688]\n"
     ]
    }
   ],
   "source": [
    "data_in_shape = (6, 6, 3)\n",
    "L = AveragePooling2D(pool_size=(3, 3), strides=(3, 3), padding='same', data_format='channels_last')\n",
    "\n",
    "layer_0 = Input(shape=data_in_shape)\n",
    "layer_1 = L(layer_0)\n",
    "model = Model(inputs=layer_0, outputs=layer_1)\n",
    "\n",
    "# set weights to random (use seed for reproducibility)\n",
    "np.random.seed(279)\n",
    "data_in = 2 * np.random.random(data_in_shape) - 1\n",
    "result = model.predict(np.array([data_in]))\n",
    "data_out_shape = result[0].shape\n",
    "data_in_formatted = format_decimal(data_in.ravel().tolist())\n",
    "data_out_formatted = format_decimal(result[0].ravel().tolist())\n",
    "print('')\n",
    "print('in shape:', data_in_shape)\n",
    "print('in:', data_in_formatted)\n",
    "print('out shape:', data_out_shape)\n",
    "print('out:', data_out_formatted)\n",
    "\n",
    "DATA['pooling.AveragePooling2D.9'] = {\n",
    "    'input': {'data': data_in_formatted, 'shape': data_in_shape},\n",
    "    'expected': {'data': data_out_formatted, 'shape': data_out_shape}\n",
    "}"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "**[pooling.AveragePooling2D.10] input 5x6x3, pool_size=(3, 3), strides=(2, 2), padding='valid', data_format='channels_first'**"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\n",
      "in shape: (5, 6, 3)\n",
      "in: [-0.733488, -0.511455, -0.012072, -0.391959, -0.506911, -0.115199, -0.002201, -0.755466, 0.749629, 0.611487, 0.615843, 0.312349, 0.948228, 0.046359, 0.58469, 0.508121, 0.152106, 0.109427, 0.550039, -0.661966, 0.65687, -0.841337, 0.751996, 0.215105, -0.283753, -0.119683, -0.00069, 0.247548, -0.756506, -0.01074, -0.999196, -0.207813, -0.496413, -0.72218, 0.806552, 0.492539, -0.600084, -0.837641, 0.636841, -0.489399, -0.255339, 0.165279, 0.776628, 0.678845, -0.362078, 0.162198, -0.715563, -0.922441, 0.198032, -0.815106, 0.656739, 0.231429, 0.784029, 0.994425, 0.04087, 0.525963, 0.072555, -0.484278, 0.018671, 0.832102, -0.893442, 0.992817, -0.3869, -0.660077, 0.878806, -0.533261, 0.084876, 0.877548, -0.530073, -0.935635, 0.918417, -0.644773, 0.453365, 0.001376, 0.292588, -0.559497, -0.164967, 0.247392, -0.438374, -0.882558, 0.373316, -0.105775, -0.557172, -0.567329, 0.520838, -0.01255, -0.651598, 0.371633, -0.136539, 0.469317]\n",
      "out shape: (5, 2, 1)\n",
      "out: [-0.253236, 0.345657, 0.02962, -0.291916, -0.031883, -0.038083, 0.079817, -0.018856, -0.075262, -0.257911]\n"
     ]
    }
   ],
   "source": [
    "data_in_shape = (5, 6, 3)\n",
    "L = AveragePooling2D(pool_size=(3, 3), strides=(2, 2), padding='valid', data_format='channels_first')\n",
    "\n",
    "layer_0 = Input(shape=data_in_shape)\n",
    "layer_1 = L(layer_0)\n",
    "model = Model(inputs=layer_0, outputs=layer_1)\n",
    "\n",
    "# set weights to random (use seed for reproducibility)\n",
    "np.random.seed(280)\n",
    "data_in = 2 * np.random.random(data_in_shape) - 1\n",
    "result = model.predict(np.array([data_in]))\n",
    "data_out_shape = result[0].shape\n",
    "data_in_formatted = format_decimal(data_in.ravel().tolist())\n",
    "data_out_formatted = format_decimal(result[0].ravel().tolist())\n",
    "print('')\n",
    "print('in shape:', data_in_shape)\n",
    "print('in:', data_in_formatted)\n",
    "print('out shape:', data_out_shape)\n",
    "print('out:', data_out_formatted)\n",
    "\n",
    "DATA['pooling.AveragePooling2D.10'] = {\n",
    "    'input': {'data': data_in_formatted, 'shape': data_in_shape},\n",
    "    'expected': {'data': data_out_formatted, 'shape': data_out_shape}\n",
    "}"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "**[pooling.AveragePooling2D.11] input 5x6x3, pool_size=(3, 3), strides=(1, 1), padding='same', data_format='channels_first'**"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\n",
      "in shape: (5, 6, 3)\n",
      "in: [-0.091121, -0.824208, -0.754072, -0.406879, 0.299281, 0.156476, -0.313986, -0.417724, 0.544086, -0.528702, -0.090158, -0.034783, -0.487503, 0.810536, 0.112947, -0.211644, -0.537382, -0.937861, -0.948686, -0.078133, 0.025745, -0.763846, -0.535144, -0.816348, -0.685814, -0.451606, 0.270969, -0.146251, -0.879815, -0.841213, -0.132799, -0.992663, 0.538393, 0.197434, -0.242139, -0.916045, 0.868866, -0.916011, -0.296894, -0.769105, 0.995731, 0.896, -0.694364, 0.647466, -0.690378, -0.512775, -0.802238, -0.633358, -0.63246, -0.314612, -0.507123, -0.634452, -0.866579, -0.308151, 0.271723, 0.791966, -0.670347, 0.174463, -0.191791, -0.052215, -0.888174, 0.090774, 0.257756, -0.64722, 0.243169, -0.60763, 0.319236, -0.454462, 0.824551, -0.942417, -0.195223, -0.695587, -0.746068, 0.367602, -0.392781, -0.777797, 0.879574, 0.529899, 0.529592, 0.040064, -0.927702, 0.039934, 0.139169, 0.397905, -0.310361, -0.260828, 0.047681, 0.684659, -0.833996, 0.973091]\n",
      "out shape: (5, 6, 3)\n",
      "out: [-0.255732, -0.270087, -0.280631, -0.292439, -0.200905, -0.166027, -0.243028, -0.088043, 0.076196, -0.171256, -0.045032, 0.154151, -0.174142, -0.211617, -0.112784, -0.106498, -0.208485, -0.13794, -0.581452, -0.519402, -0.35097, -0.577205, -0.44254, -0.264086, -0.577079, -0.538785, -0.542193, -0.548158, -0.368978, -0.392656, -0.366039, -0.379455, -0.55558, -0.292542, -0.25797, -0.403114, 0.04487, 0.129765, 0.169707, 0.022097, 0.00459, 0.105986, -0.189214, -0.173669, 0.068871, -0.38483, -0.459982, -0.383374, -0.627186, -0.579083, -0.57201, -0.612026, -0.543896, -0.499116, 0.26159, 0.053966, -0.030597, 0.041493, -0.023983, 0.03769, -0.20313, -0.180097, -0.043323, -0.222779, -0.095778, 0.059026, -0.279486, -0.239509, -0.14753, -0.318217, -0.19065, -0.13018, -0.069172, -0.023262, 0.346074, 0.048828, -0.055291, 0.082776, 0.141756, 0.094515, 0.176485, 0.029595, -0.033838, -0.093952, -0.090237, 0.097473, 0.077171, -0.180131, 0.050041, -0.018513]\n"
     ]
    }
   ],
   "source": [
    "data_in_shape = (5, 6, 3)\n",
    "L = AveragePooling2D(pool_size=(3, 3), strides=(1, 1), padding='same', data_format='channels_first')\n",
    "\n",
    "layer_0 = Input(shape=data_in_shape)\n",
    "layer_1 = L(layer_0)\n",
    "model = Model(inputs=layer_0, outputs=layer_1)\n",
    "\n",
    "# set weights to random (use seed for reproducibility)\n",
    "np.random.seed(281)\n",
    "data_in = 2 * np.random.random(data_in_shape) - 1\n",
    "result = model.predict(np.array([data_in]))\n",
    "data_out_shape = result[0].shape\n",
    "data_in_formatted = format_decimal(data_in.ravel().tolist())\n",
    "data_out_formatted = format_decimal(result[0].ravel().tolist())\n",
    "print('')\n",
    "print('in shape:', data_in_shape)\n",
    "print('in:', data_in_formatted)\n",
    "print('out shape:', data_out_shape)\n",
    "print('out:', data_out_formatted)\n",
    "\n",
    "DATA['pooling.AveragePooling2D.11'] = {\n",
    "    'input': {'data': data_in_formatted, 'shape': data_in_shape},\n",
    "    'expected': {'data': data_out_formatted, 'shape': data_out_shape}\n",
    "}"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "**[pooling.AveragePooling2D.12] input 4x6x4, pool_size=(2, 2), strides=None, padding='valid', data_format='channels_first'**"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\n",
      "in shape: (4, 6, 4)\n",
      "in: [-0.263147, -0.216555, -0.75766, -0.396007, 0.85243, 0.98415, -0.230197, -0.979579, 0.117628, -0.66833, 0.714058, -0.907302, -0.574249, 0.299573, 0.101165, 0.655872, -0.104788, 0.242064, -0.409262, -0.124059, 0.105687, -0.969325, -0.167941, 0.382377, 0.710487, 0.793042, 0.180663, -0.80231, 0.684253, -0.516992, 0.471203, -0.152325, 0.509501, 0.613742, -0.877379, 0.755416, 0.427677, 0.931956, 0.827636, -0.860685, 0.562326, -0.716081, 0.028046, 0.594422, -0.862333, 0.336131, 0.713855, 0.386247, -0.986659, 0.242413, 0.753777, -0.159358, 0.166548, -0.437388, 0.291152, -0.775555, 0.796086, -0.592021, -0.251661, 0.187174, 0.899283, 0.431861, -0.685273, -0.085991, -0.629026, -0.478334, 0.714983, 0.53745, -0.310438, 0.973848, -0.675219, 0.422743, -0.992263, 0.374017, -0.687462, -0.190455, -0.560081, 0.22484, -0.079631, 0.815275, 0.338641, -0.538279, -0.10891, -0.929005, 0.514762, 0.322038, 0.702195, -0.697122, 0.925468, -0.274158, 0.148379, 0.333239, 0.63072, -0.652956, -0.356451, -0.71114]\n",
      "out shape: (4, 3, 2)\n",
      "out: [0.339219, -0.590861, -0.206345, 0.140948, -0.18159, -0.079721, 0.417697, -0.075692, 0.620719, -0.038753, -0.169989, 0.430642, -0.253772, 0.027504, 0.383802, -0.208938, -0.110988, 0.249989, -0.238371, -0.035568, 0.15929, -0.258211, 0.157269, -0.146493]\n"
     ]
    }
   ],
   "source": [
    "data_in_shape = (4, 6, 4)\n",
    "L = AveragePooling2D(pool_size=(2, 2), strides=None, padding='valid', data_format='channels_first')\n",
    "\n",
    "layer_0 = Input(shape=data_in_shape)\n",
    "layer_1 = L(layer_0)\n",
    "model = Model(inputs=layer_0, outputs=layer_1)\n",
    "\n",
    "# set weights to random (use seed for reproducibility)\n",
    "np.random.seed(282)\n",
    "data_in = 2 * np.random.random(data_in_shape) - 1\n",
    "result = model.predict(np.array([data_in]))\n",
    "data_out_shape = result[0].shape\n",
    "data_in_formatted = format_decimal(data_in.ravel().tolist())\n",
    "data_out_formatted = format_decimal(result[0].ravel().tolist())\n",
    "print('')\n",
    "print('in shape:', data_in_shape)\n",
    "print('in:', data_in_formatted)\n",
    "print('out shape:', data_out_shape)\n",
    "print('out:', data_out_formatted)\n",
    "\n",
    "DATA['pooling.AveragePooling2D.12'] = {\n",
    "    'input': {'data': data_in_formatted, 'shape': data_in_shape},\n",
    "    'expected': {'data': data_out_formatted, 'shape': data_out_shape}\n",
    "}"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### export for Keras.js tests"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "import os\n",
    "\n",
    "filename = '../../../test/data/layers/pooling/AveragePooling2D.json'\n",
    "if not os.path.exists(os.path.dirname(filename)):\n",
    "    os.makedirs(os.path.dirname(filename))\n",
    "with open(filename, 'w') as f:\n",
    "    json.dump(DATA, f)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "{\"pooling.AveragePooling2D.0\": {\"input\": {\"data\": [0.38825, 0.616859, -0.903684, 0.806884, -0.727288, -0.673966, -0.577175, -0.387585, -0.257311, -0.509074, -0.260107, -0.175546, -0.36369, 0.000508, 0.660501, 0.597718, -0.516095, -0.635432, 0.051806, 0.827972, 0.776157, -0.924706, 0.475891, -0.245901, 0.938555, -0.153749, -0.78604, -0.743216, 0.623975, -0.88669, -0.405761, -0.047077, 0.93782, 0.817619, -0.698627, -0.779825, 0.082966, -0.198865, -0.803914, -0.013523, 0.656264, 0.20553, -0.99514, -0.845919, -0.780934, -0.54633, -0.584082, -0.381479, 0.07203, -0.932858, -0.388963, -0.640372, -0.762033, 0.520289, -0.850815, 0.83055, 0.657538, -0.995219, 0.924136, -0.09163, -0.83776, 0.570101, 0.811735, -0.248129, -0.669459, -0.622836, 0.488153, 0.819239, 0.684766, -0.329173, 0.541295, 0.675745, 0.552436, -0.314967, 0.588244, -0.764561, -0.405427, 0.165388, 0.036045, -0.7066, 0.987815, 0.424845, -0.898345, -0.084084, 0.424759, -0.463452, -0.464603, -0.889256, 0.047486, 0.593987, -0.041217, -0.674434, -0.437693, -0.698919, 0.415884, 0.503516, 0.804258, 0.474695, -0.147267, -0.807198, -0.922972, 0.369532, -0.214226, 0.34421, -0.267339, -0.858829, -0.005027, 0.268902], \"shape\": [6, 6, 3]}, \"expected\": {\"data\": [0.080558, 0.298358, -0.261849, -0.222728, -0.044366, -0.526397, 0.161472, -0.315323, 0.045766, -0.444148, 0.553021, -0.008119, -0.65684, -0.382339, -0.243379, -0.102341, -0.083589, 0.372959, -0.238065, -0.244736, 0.204864, 0.114488, -0.513306, 0.281499, -0.384388, -0.019196, 0.032737], \"shape\": [3, 3, 3]}}, \"pooling.AveragePooling2D.1\": {\"input\": {\"data\": [0.277769, -0.324717, -0.828538, 0.27327, -0.103567, 0.352973, -0.424245, 0.084882, -0.667369, -0.013292, -0.730917, 0.020447, -0.56258, -0.930644, -0.372492, 0.595927, 0.519345, 0.659999, -0.520708, -0.060843, 0.140459, 0.198302, 0.525008, 0.508564, 0.513985, 0.548433, 0.271675, -0.565162, -0.896829, 0.987411, 0.60257, 0.39488, 0.475653, 0.972433, 0.770687, -0.124055, 0.063721, -0.033112, 0.644369, -0.013292, 0.534668, -0.326544, 0.600593, -0.767345, -0.525822, -0.635478, 0.78529, 0.647604, 0.495353, -0.380054, -0.630392, 0.527641, -0.343892, 0.405197, -0.065455, -0.574106, -0.493058, 0.61698, -0.069963, 0.061398, 0.283554, 0.200134, 0.271897, 0.354207, -0.121057, -0.577198, -0.193319, -0.167341, 0.497023, 0.674803, 0.365241, -0.254262, -0.267867, 0.90223, -0.960562, 0.833171, -0.360657, 0.290601, 0.737442, -0.656173, -0.311816, -0.544177, 0.681235, 0.530767, 0.674875, -0.511685, -0.21598, -0.544874, -0.748065, 0.353896, 0.636164, -0.775521, 0.5865, -0.297541, -0.861248, 0.22867, -0.888671, -0.295104, -0.709528, -0.899564, -0.16393, 0.021623, 0.23474, 0.825311, 0.721459, -0.493389, -0.979736, 0.698471], \"shape\": [6, 6, 3]}, \"expected\": {\"data\": [0.057158, 0.00897, 0.043364, 0.140328, 0.263689, 0.116461, -0.122178, -0.248608, 0.153041, -0.134616, -0.540877, 0.277755, 0.402088, 0.188567, 0.159776, -0.067994, 0.24143, 0.241712, 0.324897, 0.210191, -0.018032, -0.021515, -0.082613, 0.345217, -0.025679, -0.024178, 0.370069, 0.649499, 0.110405, 0.031601, 0.150488, -0.035628, -0.028459, 0.371959, -0.025626, -0.129768, 0.150719, 0.024255, -0.04588, 0.005191, 0.02921, -0.015741, 0.37612, -0.131511, 0.004391, 0.279207, -0.025624, -0.275405, 0.617787, -0.221665, 0.07802, 0.207757, 0.026034, -0.021588, 0.072897, -0.029712, 0.058653, 0.152871, -0.265462, 0.095169, 0.225982, -0.273799, 0.036302, 0.0961, -0.543296, -0.125518, -0.398742, -0.108493, -0.117239, -0.133532, 0.207733, 0.264467, -0.032162, -0.353544, 0.389462], \"shape\": [5, 5, 3]}}, \"pooling.AveragePooling2D.2\": {\"input\": {\"data\": [-0.504559, 0.757141, 0.875796, -0.387981, -0.0693, -0.652691, -0.555212, -0.434044, 0.235791, -0.605425, 0.718481, -0.209725, 0.39433, -0.062265, -0.773059, 0.044988, 0.788582, -0.418206, 0.614434, -0.961147, 0.540911, 0.289499, 0.209071, -0.023188, 0.527788, -0.515541, 0.942285, 0.522851, -0.896798, -0.850198, -0.335801, -0.361879, -0.63272, -0.071082, 0.463804, 0.844358, -0.989723, -0.965627, -0.499407, -0.047122, -0.793131, 0.187077, -0.447127, 0.294048, -0.807496, 0.388664, -0.881359, 0.544367, -0.09084, -0.366615, 0.331877, 0.426563, 0.027379, -0.607851, 0.900531, -0.279492, 0.17768, 0.932378, 0.553281, 0.99734, -0.734653, -0.165923, 0.65409, -0.145211, 0.663123, 0.202177, 0.09317, 0.192798, 0.451237, 0.221026, 0.10081, 0.951492, 0.404588, -0.507086, 0.336126, -0.728857, 0.270284, 0.475983, -0.185892, -0.72956, -0.511581, 0.885467, 0.875153, -0.134057, -0.93683, 0.147558, -0.921157, 0.17617, 0.775545, -0.024447, 0.87517, -0.130003, -0.881359, 0.671017, 0.527353, 0.060533, -0.622646, 0.985845, -0.580574, 0.000245, 0.209114, -0.774112, -0.36689, -0.461625, -0.348828, -0.778202, 0.187233, 0.986566, 0.273966, 0.933391, -0.26853, 0.386163, 0.622262, -0.966476, 0.148025, -0.701246, -0.116584, -0.477621, -0.370031, 0.2975, -0.714616, 0.744059, 0.055598, -0.684043, -0.5689, -0.904974], \"shape\": [6, 7, 3]}, \"expected\": {\"data\": [-0.018813, 0.095343, 0.285551, 0.026861, -0.478921, -0.081203, -0.243397, -0.24356, -0.364213, -0.154494, 0.189535, -0.192787, -0.155372, 0.056124, -0.211579, -0.094356, -0.482831, -0.047406, -0.027626, 0.067153, 0.097571, 0.153005, -0.238591, 0.569743, 0.240334, -0.186378, 0.252911, 0.250706, -0.122229, 0.095485, 0.22954, -0.046372, 0.284856, 0.224325, 0.133238, 0.251448, -0.316224, 0.510932, -0.056892, 0.427868, 0.550299, -0.535203, 0.520094, 0.079592, -0.475971, -0.070307, 0.11048, -0.084781, -0.45366, 0.392247, -0.250397, -0.441326, -0.019338, -0.493079], \"shape\": [3, 6, 3]}}, \"pooling.AveragePooling2D.3\": {\"input\": {\"data\": [-0.854543, -0.870111, -0.87286, -0.990279, 0.026656, 0.834258, 0.54258, 0.388678, 0.910394, -0.088349, -0.941987, 0.007755, -0.766095, -0.075795, -0.073943, -0.553323, 0.487258, 0.88023, 0.615826, -0.3918, 0.891342, -0.890455, 0.99043, -0.631608, -0.248472, 0.383838, 0.792751, 0.955487, -0.795833, 0.384227, -0.836322, 0.313652, 0.129072, 0.025198, -0.893169, -0.573061, 0.51981, -0.127744, 0.275786, -0.917598, 0.225447, 0.269189, -0.745953, 0.140139, -0.499236, -0.064302, -0.285927, -0.604032, -0.694563, 0.814249, 0.73014, 0.84118, -0.052894, 0.866443, 0.398754, -0.307916, -0.918251, 0.398447, -0.100506, -0.089271, 0.056899, -0.593616, -0.286881, -0.662206, 0.861996, 0.520411, 0.728449, -0.281539, -0.850054, -0.311174, -0.324808, -0.35726, 0.910107, 0.577164, -0.452505, 0.420273, -0.715862, 0.77891, 0.888231, -0.163103, -0.512929, -0.369687, 0.720922, -0.26729, 0.337569, 0.338127, -0.737, -0.221396, 0.445575, -0.354289, 0.396925, 0.254798, -0.459922, 0.450624, -0.95101, 0.750473, -0.018957, -0.336622, 0.184966, 0.726328, 0.938513, 0.776353, -0.316331, -0.995464, 0.699672, 0.829742, 0.879587, -0.020938], \"shape\": [6, 6, 3]}, \"expected\": {\"data\": [-0.329898, 0.085059, 0.218891, -0.131232, -0.158938, 0.194092, 0.433478, -0.25963, -0.111712, 0.082366, 0.28699, -0.0656], \"shape\": [2, 2, 3]}}, \"pooling.AveragePooling2D.4\": {\"input\": {\"data\": [-0.435009, 0.201501, -0.681363, -0.811313, 0.060126, -0.947933, 0.912581, -0.749398, 0.844538, -0.910303, -0.856781, -0.080695, -0.166022, -0.413048, -0.781875, 0.563974, 0.920102, 0.401339, -0.943181, 0.186116, -0.683515, -0.374605, 0.70951, -0.586563, -0.275291, -0.534364, -0.960036, -0.160182, -0.41779, -0.130589, 0.986081, 0.305141, 0.615662, -0.092727, 0.269622, -0.952567, -0.731103, -0.599094, 0.451914, 0.712397, 0.810706, 0.284282, -0.484034, 0.927006, -0.41316, -0.318487, -0.508042, -0.823328, 0.956542, 0.817234, 0.744611, 0.576766, 0.167498, -0.973517, 0.890611, -0.27329, 0.847902, 0.592758, 0.490906, -0.989938, -0.988842, -0.673523, -0.27775, 0.230788, -0.829108, 0.585532, -0.329767, -0.442711, -0.492356, 0.678033, -0.334675, 0.678995, 0.048404, -0.614302, 0.875987, 0.752386, -0.453498, -0.509042, 0.070098, 0.638125, 0.287031, -0.735811, -0.877859, 0.771431, -0.964955, -0.314677, -0.958671, -0.443623, 0.132964, -0.719679, -0.877667, 0.57693, -0.812055, -0.164988, 0.987855, -0.233015, -0.056945, -0.036791, -0.790691, 0.143959, -0.895631, -0.106962, 0.18543, -0.094571, -0.571984, 0.959223, 0.201375, -0.801232], \"shape\": [6, 6, 3]}, \"expected\": {\"data\": [-0.269951, 0.112457, -0.299093, 0.159516, 0.031548, -0.220107, 0.029535, 0.071379, -0.177952, -0.030747, -0.383877, -0.179436], \"shape\": [2, 2, 3]}}, \"pooling.AveragePooling2D.5\": {\"input\": {\"data\": [-0.125356, 0.511947, 0.977383, 0.858394, -0.794002, -0.534285, -0.766965, 0.654446, 0.762435, 0.886059, -0.206896, 0.358434, 0.650236, -0.368147, 0.930344, 0.005596, -0.912441, -0.514276, 0.661159, -0.265948, -0.33534, 0.303754, -0.694753, -0.467584, -0.459445, 0.984093, 0.140222, 0.094479, -0.864972, -0.992886, 0.732824, 0.617015, 0.123734, -0.107109, -0.207075, 0.567955, 0.151587, -0.179476, -0.720315, 0.931922, 0.443601, 0.026364, 0.362116, 0.259068, 0.137704, -0.949458, -0.155576, 0.750443, -0.309371, 0.957827, 0.293626, 0.75601, 0.484291, 0.418412, 0.989403, -0.7105, 0.343155, 0.686513, 0.95702, -0.233024, -0.6605, 0.22654, -0.992112, 0.182307, 0.138459, -0.844054, 0.850009, -0.594768, 0.858828, 0.510735, -0.190459, 0.027627, 0.573869, 0.316089, 0.483877, 0.455003, 0.016416, 0.732321, 0.542675, -0.637051, 0.082804, 0.010443, 0.307308, -0.504457, 0.501281, 0.554288, -0.089267, -0.176817, -0.50771, -0.998761, -0.360166, 0.099193, -0.358136, 0.995764, 0.626967, -0.966323, 0.748799, -0.46523, 0.052632, 0.718055, -0.958678, -0.874386, -0.940887, 0.653789, -0.474716, 0.865378, -0.171639, -0.720755], \"shape\": [6, 6, 3]}, \"expected\": {\"data\": [0.424488, -0.310689, -0.089957, -0.061468, 0.141668, 0.067051, 0.320387, -0.217662, 0.276939, 0.689856, 0.127661, -0.145955, -0.266384, 0.117123, -0.237005, 0.451846, 0.164223, 0.399623, 0.416118, 0.264666, -0.027065, 0.504993, -0.438413, -0.310852, 0.062239, 0.132182, -0.570875], \"shape\": [3, 3, 3]}}, \"pooling.AveragePooling2D.6\": {\"input\": {\"data\": [0.927558, 0.954497, -0.546525, -0.975187, 0.975493, 0.748701, 0.906737, 0.011258, -0.767498, 0.080722, 0.348565, 0.532929, 0.819838, -0.235737, 0.071352, -0.464627, 0.676233, -0.938063, 0.404647, 0.005288, -0.467162, 0.300994, -0.461576, 0.773871, 0.457991, -0.057002, -0.611412, -0.216971, -0.706481, -0.623068, 0.808304, 0.746127, -0.316212, 0.585527, 0.068347, 0.400019, 0.818245, -0.546795, 0.030489, -0.403841, -0.872729, -0.543241, -0.242974, -0.319083, -0.203291, 0.520698, -0.453413, 0.844481, -0.137935, -0.10827, 0.932857, -0.985742, -0.026215, 0.161408, -0.953268, -0.790171, 0.300361, 0.075468, -0.333595, -0.134203, 0.771658, 0.493261, -0.877091, 0.318693, 0.773952, -0.045066, -0.145568, -0.178218, 0.280139, -0.536252, 0.342281, -0.098287, -0.616093, 0.20835, -0.908296, -0.423003, 0.329704, -0.993454, 0.553917, 0.083639, -0.0942, 0.967139, 0.572631, 0.916684, -0.511894, -0.145753, -0.528621, -0.407482, -0.925896, 0.969241, 0.916127, 0.137389, 0.308877, -0.864746, 0.612963, 0.391537, 0.787458, -0.264652, -0.756817, 0.497126, -0.421888, 0.380658, 0.971988, -0.448492, 0.868565, -0.817334, -0.734519, -0.791084], \"shape\": [6, 6, 3]}, \"expected\": {\"data\": [0.164503, 0.368426, 0.127221, 0.172634, 0.117043, 0.035916, 0.30712, -0.100915, -0.367262, 0.372973, 0.038119, -0.08375, 0.437261, 0.313743, -0.195726, 0.06045, 0.37229, -0.269022, 0.280011, -0.468953, -0.051511, 0.028042, -0.427598, -0.146018, 0.129686, -0.383995, -0.148322, 0.243524, -0.130509, 0.209514, 0.067539, 0.169997, 0.294518, -0.200107, 0.021066, 0.280713, -0.115849, -0.635823, -0.086648, 0.050078, -0.258037, -0.439457, 0.342019, 0.123679, -0.070242, 0.138972, 0.008513, 0.503103, -0.451374, 0.007395, 0.319029, -0.760997, 0.158033, 0.03156, -0.479224, -0.146428, -0.433898, 0.24451, 0.143252, -0.524737, 0.652852, 0.480871, -0.024918, 0.157092, 0.255653, 0.155784, -0.400299, -0.226896, 0.155618, -0.471867, -0.291807, 0.435477, -0.246929, 0.322102, -0.300334, 0.013407, 0.190413, -0.363234, 0.70141, -0.007568, 0.111581, 0.48109, -0.110875, 0.409321, -0.19118, -0.563665, 0.129525, -0.612408, -0.830207, 0.089078, 0.02569, 0.375176, 0.350207, -0.038644, 0.174156, -0.18264, 0.642292, -0.34327, -0.18808, 0.734557, -0.43519, 0.624611, 0.077327, -0.591505, 0.03874, -0.817334, -0.734519, -0.791084], \"shape\": [6, 6, 3]}}, \"pooling.AveragePooling2D.7\": {\"input\": {\"data\": [-0.030989, -0.346015, -0.890642, 0.30811, -0.606825, 0.402975, 0.602736, 0.344604, 0.306091, -0.032882, -0.087472, -0.504624, -0.540123, -0.600461, -0.356026, -0.166262, -0.931461, -0.400375, 0.139861, -0.018562, -0.77588, 0.053876, 0.409865, 0.873443, 0.68555, 0.27871, 0.850652, 0.754905, -0.449262, 0.988666, 0.820557, 0.32874, -0.511855, -0.376221, 0.156768, 0.714855, 0.652744, -0.770455, -0.420355, -0.112187, 0.057803, 0.08658, -0.290285, 0.132163, 0.355278, 0.478874, 0.219867, 0.84058, -0.208074, -0.408705, -0.531282, 0.413349, 0.231145, -0.454075, -0.873335, 0.392051, 0.153578, -0.986842, 0.015453, 0.397118, 0.508155, 0.965975, 0.697653, -0.112096, 0.759372, 0.559116, 0.67722, -0.117106, -0.590918, -0.665737, 0.55871, -0.858197, -0.708748, 0.748662, -0.824209, 0.616397, -0.011734, -0.182872, -0.733068, 0.364029, 0.561509, 0.219712, 0.973953, -0.171855, 0.60424, -0.828373, -0.98636, 0.448686, -0.322057, 0.982714, -0.821071, 0.580936, -0.725164, -0.374259, 0.933695, 0.162221, 0.253756, -0.83158, 0.440214, 0.612281, -0.342427, -0.890935, 0.767288, -0.113737, 0.239906, -0.787757, 0.979323, 0.603794, 0.819906, -0.759745, 0.3452, -0.275531, -0.838519, -0.306254, 0.019171, 0.086698, 0.646429, -0.657404, 0.564509, -0.150949, 0.885221, -0.240635, 0.774093, 0.413537, 0.353869, -0.54616], \"shape\": [6, 7, 3]}, \"expected\": {\"data\": [0.254137, -0.066066, 0.309107, 0.587825, -0.108193, 0.637096, 0.536329, 0.034152, 0.069569, -0.032167, -0.050606, -0.164412, -0.107466, -0.536402, -0.115475, 0.128539, -0.415669, -0.377508, 0.013837, 0.019621, -0.34465, 0.188428, 0.248574, 0.291014, 0.070571, 0.063191, -0.284954, -0.292303, 0.282453, -0.666941, -0.138084, 0.340031, -0.326895, -0.494212, 0.18995, 0.232333, -0.248011, 0.579852, 0.371106, 0.363933, 0.969964, 0.262899, 0.271269, -0.232713, 0.236337, 0.042998, -0.334846, 0.074124, -0.362923, 0.190702, -0.055692, -0.189684, 0.188331, 0.274478, 0.273463, -0.212533, 0.043106, 0.669582, -0.085733, -0.105774, 0.590413, 0.120066, -0.153127], \"shape\": [3, 7, 3]}}, \"pooling.AveragePooling2D.8\": {\"input\": {\"data\": [-0.608354, 0.814456, 0.038567, 0.476287, 0.216015, -0.481648, 0.644763, 0.10917, -0.471387, -0.32636, -0.733307, 0.809109, 0.938018, 0.45454, 0.380736, -0.549826, 0.581014, -0.136962, 0.510985, -0.437531, 0.591492, 0.78169, 0.91889, -0.091291, 0.92621, 0.499937, 0.783184, 0.856769, 0.825821, -0.337421, -0.464183, 0.355169, -0.27325, -0.710723, 0.88219, 0.170054, 0.491526, -0.54194, 0.599706, -0.258815, 0.851444, 0.993577, -0.257873, 0.639983, 0.717092, -0.756212, 0.835492, 0.687835, 0.419306, 0.437005, 0.499287, 0.611132, -0.343117, 0.655711, 0.887305, 0.274611, 0.808091, -0.526638, -0.656007, -0.224877, -0.516879, 0.925214, 0.465157, -0.583775, -0.778813, -0.742375, 0.581248, 0.683255, 0.656146, 0.421657, 0.606407, 0.192823, -0.079634, 0.840454, 0.283657, 0.437733, 0.422174, 0.136574, -0.183453, 0.489156, -0.046592, -0.593012, 0.673468, -0.850704, 0.291874, 0.50983, 0.195928, -0.861694, -0.667353, -0.917666, -0.893135, -0.40417, 0.596787, -0.693049, -0.689967, 0.716219, -0.853606, 0.080078, 0.645037, -0.438396, 0.947757, -0.117767, 0.273004, 0.764594, 0.361936, 0.067879, 0.692411, 0.484743], \"shape\": [6, 6, 3]}, \"expected\": {\"data\": [0.300713, 0.341158, 0.297699, 0.001991, 0.36609, 0.272789, -0.26904, 0.142394, 0.375561, -0.093468, 0.381284, -0.081882], \"shape\": [2, 2, 3]}}, \"pooling.AveragePooling2D.9\": {\"input\": {\"data\": [0.171575, -0.01371, 0.669445, 0.471563, -0.43304, -0.948817, 0.891046, 0.345734, -0.618425, 0.178066, 0.566425, 0.651806, -0.679432, -0.340808, -0.856184, 0.880661, 0.739249, -0.736727, -0.000875, 0.565201, -0.716035, -0.230306, -0.308616, 0.844726, 0.8199, 0.814069, 0.78588, -0.097822, 0.987499, -0.831452, -0.075891, 0.222998, 0.855855, 0.184853, 0.216484, 0.67179, 0.320002, 0.777718, -0.328422, 0.352854, -0.70515, 0.602826, -0.341731, 0.944352, 0.144706, 0.738155, -0.458994, -0.500593, -0.052743, -0.397156, 0.086182, -0.389886, -0.179817, -0.573505, -0.704485, 0.215619, 0.580762, 0.445583, -0.941526, -0.391809, 0.79715, -0.173917, 0.115565, -0.647815, -0.498079, 0.846334, 0.37206, -0.970387, 0.431344, 0.430746, 0.647521, -0.134103, 0.236121, 0.228449, 0.961617, 0.615245, -0.43955, 0.231622, -0.449544, -0.076076, 0.938768, -0.004633, 0.245633, 0.15158, -0.74244, 0.156049, 0.392354, -0.577064, 0.550525, -0.447511, 0.327057, 0.412246, 0.143231, -0.796634, -0.261061, 0.231928, 0.353476, 0.647848, -0.841934, 0.204776, -0.539921, -0.791494, -0.838732, 0.137563, -0.107536, 0.002298, 0.613496, 0.142227], \"shape\": [6, 6, 3]}, \"expected\": {\"data\": [0.27267, 0.220729, 0.048432, 0.076218, 0.150654, -0.136981, 0.091552, -0.043108, 0.218861, -0.200089, 0.038044, 0.053688], \"shape\": [2, 2, 3]}}, \"pooling.AveragePooling2D.10\": {\"input\": {\"data\": [-0.733488, -0.511455, -0.012072, -0.391959, -0.506911, -0.115199, -0.002201, -0.755466, 0.749629, 0.611487, 0.615843, 0.312349, 0.948228, 0.046359, 0.58469, 0.508121, 0.152106, 0.109427, 0.550039, -0.661966, 0.65687, -0.841337, 0.751996, 0.215105, -0.283753, -0.119683, -0.00069, 0.247548, -0.756506, -0.01074, -0.999196, -0.207813, -0.496413, -0.72218, 0.806552, 0.492539, -0.600084, -0.837641, 0.636841, -0.489399, -0.255339, 0.165279, 0.776628, 0.678845, -0.362078, 0.162198, -0.715563, -0.922441, 0.198032, -0.815106, 0.656739, 0.231429, 0.784029, 0.994425, 0.04087, 0.525963, 0.072555, -0.484278, 0.018671, 0.832102, -0.893442, 0.992817, -0.3869, -0.660077, 0.878806, -0.533261, 0.084876, 0.877548, -0.530073, -0.935635, 0.918417, -0.644773, 0.453365, 0.001376, 0.292588, -0.559497, -0.164967, 0.247392, -0.438374, -0.882558, 0.373316, -0.105775, -0.557172, -0.567329, 0.520838, -0.01255, -0.651598, 0.371633, -0.136539, 0.469317], \"shape\": [5, 6, 3]}, \"expected\": {\"data\": [-0.253236, 0.345657, 0.02962, -0.291916, -0.031883, -0.038083, 0.079817, -0.018856, -0.075262, -0.257911], \"shape\": [5, 2, 1]}}, \"pooling.AveragePooling2D.11\": {\"input\": {\"data\": [-0.091121, -0.824208, -0.754072, -0.406879, 0.299281, 0.156476, -0.313986, -0.417724, 0.544086, -0.528702, -0.090158, -0.034783, -0.487503, 0.810536, 0.112947, -0.211644, -0.537382, -0.937861, -0.948686, -0.078133, 0.025745, -0.763846, -0.535144, -0.816348, -0.685814, -0.451606, 0.270969, -0.146251, -0.879815, -0.841213, -0.132799, -0.992663, 0.538393, 0.197434, -0.242139, -0.916045, 0.868866, -0.916011, -0.296894, -0.769105, 0.995731, 0.896, -0.694364, 0.647466, -0.690378, -0.512775, -0.802238, -0.633358, -0.63246, -0.314612, -0.507123, -0.634452, -0.866579, -0.308151, 0.271723, 0.791966, -0.670347, 0.174463, -0.191791, -0.052215, -0.888174, 0.090774, 0.257756, -0.64722, 0.243169, -0.60763, 0.319236, -0.454462, 0.824551, -0.942417, -0.195223, -0.695587, -0.746068, 0.367602, -0.392781, -0.777797, 0.879574, 0.529899, 0.529592, 0.040064, -0.927702, 0.039934, 0.139169, 0.397905, -0.310361, -0.260828, 0.047681, 0.684659, -0.833996, 0.973091], \"shape\": [5, 6, 3]}, \"expected\": {\"data\": [-0.255732, -0.270087, -0.280631, -0.292439, -0.200905, -0.166027, -0.243028, -0.088043, 0.076196, -0.171256, -0.045032, 0.154151, -0.174142, -0.211617, -0.112784, -0.106498, -0.208485, -0.13794, -0.581452, -0.519402, -0.35097, -0.577205, -0.44254, -0.264086, -0.577079, -0.538785, -0.542193, -0.548158, -0.368978, -0.392656, -0.366039, -0.379455, -0.55558, -0.292542, -0.25797, -0.403114, 0.04487, 0.129765, 0.169707, 0.022097, 0.00459, 0.105986, -0.189214, -0.173669, 0.068871, -0.38483, -0.459982, -0.383374, -0.627186, -0.579083, -0.57201, -0.612026, -0.543896, -0.499116, 0.26159, 0.053966, -0.030597, 0.041493, -0.023983, 0.03769, -0.20313, -0.180097, -0.043323, -0.222779, -0.095778, 0.059026, -0.279486, -0.239509, -0.14753, -0.318217, -0.19065, -0.13018, -0.069172, -0.023262, 0.346074, 0.048828, -0.055291, 0.082776, 0.141756, 0.094515, 0.176485, 0.029595, -0.033838, -0.093952, -0.090237, 0.097473, 0.077171, -0.180131, 0.050041, -0.018513], \"shape\": [5, 6, 3]}}, \"pooling.AveragePooling2D.12\": {\"input\": {\"data\": [-0.263147, -0.216555, -0.75766, -0.396007, 0.85243, 0.98415, -0.230197, -0.979579, 0.117628, -0.66833, 0.714058, -0.907302, -0.574249, 0.299573, 0.101165, 0.655872, -0.104788, 0.242064, -0.409262, -0.124059, 0.105687, -0.969325, -0.167941, 0.382377, 0.710487, 0.793042, 0.180663, -0.80231, 0.684253, -0.516992, 0.471203, -0.152325, 0.509501, 0.613742, -0.877379, 0.755416, 0.427677, 0.931956, 0.827636, -0.860685, 0.562326, -0.716081, 0.028046, 0.594422, -0.862333, 0.336131, 0.713855, 0.386247, -0.986659, 0.242413, 0.753777, -0.159358, 0.166548, -0.437388, 0.291152, -0.775555, 0.796086, -0.592021, -0.251661, 0.187174, 0.899283, 0.431861, -0.685273, -0.085991, -0.629026, -0.478334, 0.714983, 0.53745, -0.310438, 0.973848, -0.675219, 0.422743, -0.992263, 0.374017, -0.687462, -0.190455, -0.560081, 0.22484, -0.079631, 0.815275, 0.338641, -0.538279, -0.10891, -0.929005, 0.514762, 0.322038, 0.702195, -0.697122, 0.925468, -0.274158, 0.148379, 0.333239, 0.63072, -0.652956, -0.356451, -0.71114], \"shape\": [4, 6, 4]}, \"expected\": {\"data\": [0.339219, -0.590861, -0.206345, 0.140948, -0.18159, -0.079721, 0.417697, -0.075692, 0.620719, -0.038753, -0.169989, 0.430642, -0.253772, 0.027504, 0.383802, -0.208938, -0.110988, 0.249989, -0.238371, -0.035568, 0.15929, -0.258211, 0.157269, -0.146493], \"shape\": [4, 3, 2]}}}\n"
     ]
    }
   ],
   "source": [
    "print(json.dumps(DATA))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "anaconda-cloud": {},
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.3"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 1
}
